<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link href="${ctxPath}/assets/expand/images/favicon.ico" rel="icon">
    <title>${systemName!}</title>
    <link rel="stylesheet" href="${ctxPath}/assets/common/layui/css/layui.css">
    <link rel="stylesheet" href="${ctxPath}/assets/common/module/admin.css">
</head>
<body class="layui-layout-body">

    <div class="layui-layout layui-layout-admin">

        <!--头部_header-->

        @include("/common/_header.html"){}

        <!--侧边栏_sidebar-->
        @include("/common/_sidebar.html"){}

        <!--主体部分_body-->
        @include("/common/_body.html"){}

        <!--底部_footer-->
        @include("/common/_footer.html"){}

    </div>

    <!-- 加载动画，移除位置在common.js中 -->
    @include("/common/loading.html"){}

    @/* 加入contextPath属性和session超时的配置 */
    <script type="text/javascript">
        var Lu = {
            ctxPath: "",
            addCtx: function (ctx) {
                if (this.ctxPath === "") {
                    this.ctxPath = ctx;
                }
            }
        };
        Lu.addCtx("${ctxPath}");
    </script>


</body>

<script type="text/javascript" src="${ctxPath}/assets/common/layui/layui.js"></script>
<script type="text/javascript" src="${ctxPath}/assets/common/js/common.js"></script>
<script>
    layui.use(['layer', 'element', 'admin', 'ax', 'index', 'notice'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var admin = layui.admin;
        var $ax = layui.ax;
        var index = layui.index;
        var notice = layui.notice;

        // // 默认加载主页
        // index.loadHome({
        //     menuPath: '${ctxPath}/system/console',
        //     menuName: '<i class="layui-icon layui-icon-home"></i>'
        // });

        // 修改密码点击事件
        $('#setPsw').click(function () {
            admin.open({
                id: 'pswForm',
                type: 2,
                title: '修改密码',
                shade: 0,
                content: '${ctxPath}/system/user/toUpdatePwd'
            });
        });

        // 退出登录点击事件
        $('#btnLogout').click(function () {
            layer.confirm('确定退出登录？', {
                skin: 'layui-layer-admin'
            }, function () {
                window.location.href = "${ctxPath}/logout";
            });
        });

        //消息框
        $("#messageClick").on('click',function () {
            noticeInfo('${notice_title!}', '${notice_message!}');
        });

        //更新系统全局缓存
        $("#updateGlobalCache").on('click', function () {
            var ajax = new $ax(Lu.ctxPath + "/system/updateGlobalCache", function (data) {
                Lu.success("更新缓存成功!");
            }, function (data) {
                Lu.error("更新缓存失败!" + data.responseJSON.message + "!");
            });
            ajax.start();
        });

        function noticeInfo(title,message){
            // 通知消息
            notice.info({
                title: title,
                message: message
            });
        }

    });
</script>

</html>